package cn.jingzhuan.element.demo.view.util
import android.R
import android.content.Context
import android.graphics.drawable.StateListDrawable

/**
 * 状态视图构建类
 */
class StateListDrawableBuilder(var context:Context){

    private var stateListDrawable: StateListDrawable = StateListDrawable()

    fun addState(drawableId: Int) : StateListDrawableBuilder {
        this.addState(drawableId)
        return this
    }

    fun addState(drawableId: Int, vararg states:Int) : StateListDrawableBuilder {
        stateListDrawable.addState(states,context.resources.getDrawable(drawableId,context.theme))
        return this
    }

    fun build() = stateListDrawable

    /**
     * 状态常量定义
     */
    companion object {
        val state_above_anchor = R.attr.state_above_anchor
        val state_accelerated = R.attr.state_accelerated
        val state_activated = R.attr.state_activated
        val state_active = R.attr.state_active
        val state_checkable = R.attr.state_checkable
        val state_checked = R.attr.state_checked
        val state_drag_can_accept = R.attr.state_drag_can_accept
        val state_drag_hovered = R.attr.state_drag_hovered
        val state_empty = R.attr.state_empty
        val state_enabled = R.attr.state_enabled
        val state_expanded = R.attr.state_expanded
        val state_first = R.attr.state_first
        val state_focused = R.attr.state_focused
        val state_hovered = R.attr.state_hovered
        val state_last = R.attr.state_last
        val state_long_pressable = R.attr.state_long_pressable
        val state_middle = R.attr.state_middle
        val state_multiline = R.attr.state_multiline
        val state_pressed = R.attr.state_pressed
        val state_selected = R.attr.state_selected
        val state_single = R.attr.state_single
        val state_window_focused = R.attr.state_window_focused
    }


}

